package org.jgs1904.chanmufeng;

/**
 * 饿汉式单例-同步锁
 *
 * @author: 默苍璃
 * @date: 2024-07-01 10:47
 */
public class LazySynchronizedSingleton {
    private static LazySynchronizedSingleton instance;

    private LazySynchronizedSingleton() {
    }

    // 添加synchronized关键字
    public synchronized static LazySynchronizedSingleton getInstance() {
        if (instance == null) {
            instance = new LazySynchronizedSingleton();
        }
        return instance;
    }

}
